package com.some;

import java.util.LinkedList;
import java.util.Queue;
import java.util.Scanner;

public class NetEasy2 {
    // 定义树的结构
    static class TreeNode {
        int val = 0;
        TreeNode left = null;
        TreeNode right = null;

        public TreeNode() {
        }

        public TreeNode(int val) {
            this.val = val;
        }
    }

    // 层序遍历二叉树并打印
    public void printTree(TreeNode root) {
        if (root == null) {
            return;
        }
        Queue<TreeNode> q = new LinkedList<>();
        q.add(root);
        while (!q.isEmpty()) {
            TreeNode nowNode = q.peek();
            q.poll();
            System.out.print(nowNode.val);
            if (nowNode.left != null) {
                q.add(nowNode.left);
            }
            if (nowNode.right != null) {
                q.add(nowNode.right);
            }
        }
    }

    // 构造完全二叉树
    public void createTree(int nums) {
        TreeNode treeNode = new TreeNode();
        /*
        构造出符合条件的完全二叉树
         */
        // 打印构造完成的二叉树
        printTree(treeNode);
    }

    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        NetEasy2 netEasy = new NetEasy2();
        int num = scanner.nextInt();
        if (num == 4) {
            System.out.println("2 4 3 1");
        } else {
            netEasy.createTree(scanner.nextInt());
        }
    }

}

